<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />


        <script type="text/css">
            .roleclass { color:#fff;}
            .objectclass { color:#fff;}
        </script>

        <script type="text/javascript">
            //var i = 0;
            function addp()
            {
                var i = $(".autocomplete").length;
                //alert("i = "+i);
                if (i < 4)
                {
                    i++;
                }
                else
                {
                    alert('up to four!');
                    return;
                }
                //alert("i = "+i);
                str = '<p id="p' + i + '">'
                    +'<input type="text" size="39"  placeholder="<?= translate('PLASE_INPUT_ITEM') ?>" '
                    +' name="row[item][]" id="itemid' + i + '" class="autocomplete" table="type_object" autocomplete="off" >'
                    +'<input type="text" size="8" placeholder="<?= translate('PLASE_INPUT_AMOUNT') ?>" '
                    +' name="row[amount][]" id="num' + i + '" >'
//                    +'<?//=translate('MAIL_EQUIPLEVEL')  ?>//'
//                    +'<select name="row[equiplevel][]" id="equiplevel'+i+'" >'
//                    +'<?php //for ($i=0; $i<=10;++$i) { ?>//'
//                    +'<option value="<?//=$i ?>//"><?//=$i ?>//</option>'
//                    +'<?php //}?>//'
//                    +'</select>'
                    +'</p>';
                //alert(" str = "+str);
                $("#add").append(str);
                autocomplete();

                $("#num"+i).formValidator({empty: false, onshow: '<?= translate('MAIL_TIME_LIMIT_MIN_MAX') ?>'})
                    .inputValidator({type: 'number', min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});

            }
            function removep()
            {
                var i = $(".autocomplete").length;
                //alert("i = "+i);
                if (i > 0)
                {
                    $("#p" + i).remove();
                }

            }
        </script>
    </head>
    <body>

        <?php include(VIEWPATH . 'common/main_header.php'); ?> 
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
                 <tr align="left">
                    <th colspan="2" align="left"><?= $title ?></th>
                </tr>  
                <tr><td><?= translate('SELECT_AREA') ?>:</td><td><?= $arealist ?></td></tr>

                <tr><td><?= translate('ROLE_FIGHT_VALUE_L') ?>:</td><td><input type="text" name="row[role_fight_value_l]" id="rolefightvaluel" size="25" /></td></tr>
                <tr><td><?= translate('ROLE_FIGHT_VALUE_H') ?>:</td><td><input type="text" name="row[role_fight_value_h]" id="rolefightvalueh" size="25" /></td></tr>
                <tr><td><?= translate('ROLE_LEVEL') ?>:</td><td><input type="text" name="row[role_level]" id="rolelevel" size="25" /></td></tr>

                <!-- 换成多行输入框
                <tr><td><?= translate('ROLE_ID') ?>:</td><td><input type="text" name="row[role_id]" id="roleid" size="2500" /></td></tr> 
                -->
                <tr><td><?= translate('ROLE_ID') ?>:</td><td><textarea name="row[role_id]" id="roleid" cols="100" rows="25"></textarea></td></tr>

                <tr><td><?= translate('SEAL_TITLE')?>:</td><td><input type="text" name="row[title]" id="title" size="25" /></td></tr>
                <tr><td><?= translate('OBJECT_GMID') ?>:</td><td id="add" size="25">
                        <p id="p">
                            <input type="button" onclick="addp()" value="<?= translate('ADD_ONE') ?>" />
                            <input type="button" onclick="removep()" value="<?= translate('REMOVE_ONE') ?>" />
                        </p>
                    </td></tr>
<!--                <tr><td>--><?//= translate('OBJECT_GMID')?><!--:</td><td><input type="text" name="row[gmid]" id="gmid" size="25" /></td></tr>       -->
                <tr><td></td><td><input type="submit" value="<?= translate('SUBMIT') ?>" id="submit"/> <input type="reset" value="<?= translate('RESET') ?>" id="reset"/></td></tr>
            </table>
        </form>
        <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#area_host").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#title").formValidator({empty: false, onshow: '<?= translate('PLEASE_INPUT_SEAL_TITLE') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#rolelevel").formValidator({empty: false, onshow: '<?= translate('C_ONLY_NUM') ?>'}).regexValidator({regexp: 'num', datatype: 'enum', onerror: '<?= translate('C_ONLY_NUM') ?>'});
                $("#rolefightvaluel").formValidator({empty: false, onshow: '<?= translate('C_ONLY_NUM') ?>'}).regexValidator({regexp: 'num', datatype: 'enum', onerror: '<?= translate('C_ONLY_NUM') ?>'});
                $("#rolefightvalueh").formValidator({empty: false, onshow: '<?= translate('C_ONLY_NUM') ?>'}).regexValidator({regexp: 'num', datatype: 'enum', onerror: '<?= translate('C_ONLY_NUM') ?>'});
                //$("#roleid").formValidator({empty: false, onshow: '<?= translate('C_ONLY_NUM') ?>'}).regexValidator({regexp: 'num', datatype: 'enum', onerror: '<?= translate('C_ONLY_NUM') ?>'}); 
                $("#gmid").formValidator({empty: false, onshow: '<?= translate('C_ONLY_NUM') ?>'}).regexValidator({regexp: 'num', datatype: 'enum', onerror: '<?= translate('C_ONLY_NUM') ?>'});                        
            });
        </script>
    </body>
</html>
